package com.mygdx.game.group;

import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.scenes.scene2d.InputEvent;
import com.badlogic.gdx.scenes.scene2d.ui.Image;
import com.badlogic.gdx.scenes.scene2d.utils.ClickListener;
import com.mygdx.game.MainGame;
import com.mygdx.game.group.basegroup.BaseGroup;
import com.mygdx.game.resource.Res;

public class BottomGroup extends BaseGroup {
    //游戏帮助和退出游戏标签
    private Image gameHelp;
    private Image exitGame;

    public BottomGroup(MainGame mainGame) {
        super(mainGame);
        init();
    }


    public void init() {

        setSize(getMainGame().getWorldWidth() - 40, getHeight());
        gameHelp = new Image(getMainGame().getTextureAtlas().findRegion(Res.Atlas.GAME_BTN_HELP));
        //最左边底部
        gameHelp.setPosition(0, 0);
        gameHelp.addListener(new ClickListener() {
            @Override
            public void clicked(InputEvent event, float x, float y) {
                //显示帮助舞台
                getMainGame().getGameScreen().setShowHelpStage(true);
            }
        });
        addActor(gameHelp);
        exitGame = new Image(getMainGame().getTextureAtlas().findRegion(Res.Atlas.GAME_BTN_EXIT));
        //最右边底部
        exitGame.setPosition(getWidth() - exitGame.getWidth(), 0);
        exitGame.addListener(new ClickListener() {
            @Override
            public void clicked(InputEvent event, float x, float y) {
                //显示退出游戏舞台
                getMainGame().getGameScreen().setShowExitConfirmStage(true);
            }
        });
        addActor(exitGame);
    }

}
